<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('基础表现')"/>
    <th:block th:include="include :: summernote-css"/>
    <style>
        .sortable-ghost {
            opacity: 0.4;
            background-color: #F4E2C9;
        }

        .block__list li {
            cursor: pointer;


        }

        .block__list {
            list-style: none;
            margin: 0;
            padding: 0;
        }

        .block__list li {
            width: auto;
            margin: 0 2px;
            float: left;
            background: #d7d7dd;
            border-radius: 5px;

        }

        .col-sm-2 {
            width: 7%;
            padding: 0;
            text-align: center;
        }
        .col-sm-4{
            width: 43%;
            padding: 0;
        }

        .btn-default {
            margin: 0px 5px 3px 0px;
        }

        .note-editor .panel-heading {
            padding: 0px 5px;
        }

        .note-editor .btn-sm, .note-editor .btn-xs {
            padding: 1px 5px;
            font-size: 12px;
            line-height: 1.5;
            border-radius: 3px;
        }

        .note-editor {
            height: auto !important;
            min-height: 69px;
            border: solid 1px #e5e6e7;
        }

        .note-editor p {
            margin: 0 0 0px;
        }

        .form-group {
            /* margin-bottom: 15px; */
            height: auto;
            background-color: #efeded;
        }

        label{
            margin-top: 35px;
            font-weight: bolder;
            font-size: 15px;
            /*background: #dee1e1;*/
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <!--    <div class="row" style="height: 45%">-->
    <!--        <div class="col-sm-12 select-table table-striped">-->
    <!--            <table id="bootstrap-table"></table>-->
    <!--        </div>-->
    <!--    </div>-->

    <div class="col-sm-12 search-collapse">
        <form class="form-horizontal m" id="data-form">
            <input name="childCourseId" id="childCourseId" th:value="${childCourseId}" type="hidden"/>
            <input name="childId" id="childId" th:value="${childId}" type="hidden"/>

            <!--            本节课填写-->
            <div class="form-group">
                <label class="col-sm-2 font-noraml">不良体态：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('bultt')}">
                        <a onclick="descClick(this)"  name="bultt" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="bultt" id="bultt" class="form-control summernote"></div>
                </div>
                <label class="col-sm-2 font-noraml">站姿不良：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('zhanzbl')}">
                        <a onclick="descClick(this)" name="zhanzbl"  class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="zhanzbl" id="zhanzbl" class="form-control summernote"></div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 font-noraml">坐姿不良：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('zuozbl')}">
                        <a onclick="descClick(this)" name="zuozbl"  class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="zuozbl" id="zuozbl" class="form-control summernote"></div>
                </div>
                <label class="col-sm-2 font-noraml">动态平衡：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('dongtph')}">
                        <a onclick="descClick(this)" name="dongtph" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="dongtph" id="dongtph" class="form-control summernote"></div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 font-noraml">静态平衡：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('jingtph')}">
                        <a onclick="descClick(this)" name="jingtph" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="jingtph" id="jingtph" class="form-control summernote"></div>
                </div>
                <label class="col-sm-2 font-noraml">协调性：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('xietx')}">
                        <a onclick="descClick(this)" name="xietx" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="xietx" id="xietx" class="form-control summernote"></div>
                </div>
            </div>
            <div class="form-group">

                <label class="col-sm-2 font-noraml">空间常识：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('kongjcs')}">
                        <a onclick="descClick(this)" name="kongjcs" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="kongjcs" id="kongjcs" class="form-control summernote"></div>
                </div>
                <label class="col-sm-2 font-noraml">空间判断：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('kongjpd')}">
                        <a onclick="descClick(this)" name="kongjpd" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="kongjpd" id="kongjpd" class="form-control summernote"></div>
                </div>
            </div>

            <div class="form-group">

                <label class="col-sm-2 font-noraml">10米折返跑时间：</label>
                <div class="col-sm-4" >
                    <div name="speed" id="speed" class="form-control summernote"></div>
                </div>
                <label class="col-sm-2 font-noraml">攀爬动作：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('panpdz')}">
                        <a onclick="descClick(this)" name="panpdz"  class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="panpdz" id="panpdz" class="form-control summernote"></div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 font-noraml">距离判断：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('julpd')}">
                        <a onclick="descClick(this)" name="julpd" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="julpd" id="julpd" class="form-control summernote"></div>
                </div>
                <label class="col-sm-2 font-noraml">跨越：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('kuay')}">
                        <a onclick="descClick(this)" name="kuay" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="kuay" id="kuay" class="form-control summernote"></div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 font-noraml">绕：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('rao')}">
                        <a onclick="descClick(this)" name="rao" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="rao" id="rao" class="form-control summernote"></div>
                </div>
                <label class="col-sm-2 font-noraml">钻：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('zuan')}">
                        <a onclick="descClick(this)" name="zuan" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="zuan" id="zuan" class="form-control summernote"></div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 font-noraml">插棍：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('chag')}">
                        <a onclick="descClick(this)" name="chag" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="chag" id="chag" class="form-control summernote"></div>
                </div>
                <label class="col-sm-2 font-noraml">力量：</label>
                <div class="col-sm-4" >
                    <div th:with="type=${@dict.getType('lil')}">
                        <a onclick="descClick(this)" name="lil" class="btn btn-default btn-xs " th:each="dict : ${type}" th:text="${dict.dictLabel}"></a>
                    </div>
                    <div name="lil" id="lil" class="form-control summernote"></div>
                </div>
            </div>
        </form>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: summernote-js"/>
<script th:inline="javascript">
    // 权限

    // 字典
    var prefix = ctx + "business/courseChildScore";
    $(function () {
        $('.summernote').summernote({
            lang: 'zh-CN',
            minHeight: 20,
            toolbar: [
                ['font', ['strikethrough']],
            ],
            lineHeight: 20
        });
        //当天回填
        $.ajax({
            type: "GET",
            url: prefix + "/getBasicExpression?childCourseId="+$("#childCourseId").val()+"&childId="+$("#childId").val(),
            error: function (request) {
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                //回填
                if(data.code ==0 && data.data !=undefined){
                    var obj = data.data.oldRecords;
                    for(var i in obj){
                        $("#"+obj[i].basicDesc).summernote('code',obj[i].basicExpression);
                    }
                }
            }
        });
    });

    function descClick(obj) {
        var str = $("#"+obj.name).summernote('code');
        if(str=="<p><br></p>"){
            str="";
        }
        str+=obj.text+"；";
        $("#"+obj.name).summernote('code',str);
    }


    function submitHandler() {
        if ($.validate.form()) {
            add();
        }
    }

    function add() {
       var a= $('#data-form').serialize();
        var basicExpression = {
            "bultt ": $("#bultt ").summernote('code'),
            "zhanzbl": $("#zhanzbl").summernote('code'),
            "zuozbl": $("#zuozbl").summernote('code'),
            "dongtph": $("#dongtph").summernote('code'),
            "jingtph": $("#jingtph").summernote('code'),
            "xietx": $("#xietx").summernote('code'),
            "kongjcs": $("#kongjcs").summernote('code'),
            "kongjpd": $("#kongjpd").summernote('code'),
            "speed": $("#speed").summernote('code'),
            "panpdz": $("#panpdz").summernote('code'),
            "julpd": $("#julpd").summernote('code'),
            "kuay": $("#kuay").summernote('code'),
            "rao": $("#rao").summernote('code'),
            "zuan": $("#zuan").summernote('code'),
            "chag": $("#chag").summernote('code'),
            "lil": $("#lil").summernote('code')
        }
        var data = {
            "childCourseId": $("#childCourseId").val(),
            "childId": $("#childId").val(),
            "basicExpression": JSON.stringify(basicExpression)
        }
        $.ajax({
            type: "POST",
            url: prefix + "/saveBasicExpression",
            data: JSON.stringify(data),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            error: function (request) {
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                $.modal.alertSuccess("保存成功");
            }
        });
    }


    /*详细*/
    function detail(trainPackageId) {
        var url = prefix + "/detail/" + trainPackageId;
        $.modal.openTab("训练包详情", url);
    }

    function del(id) {
        $.ajax({
            url: prefix + "/saveBasicExpression",
            type: 'POST',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            data: JSON.stringify(reqData),
            error: function (request) {
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                $.table.refresh();
            }
        });
    }
</script>
</body>

</html>